import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './assets/main.css'  // 导入全局样式
import App from './App.vue'
import router from './router'
import hljs from 'highlight.js'
import 'highlight.js/styles/monokai-sublime.css'  // 使用 Monokai Sublime 主题

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册 highlight.js
app.directive('highlight', {
  mounted(el) {
    hljs.highlightElement(el)
  },
  updated(el) {
    hljs.highlightElement(el)
  }
})

app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.mount('#app')
